From: Bjorn Helgaas Date: Tue, 8 Oct 2013 20:20:24 +0000 (-0600) Subject: kobject: fix kset sample error path X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~10^2~7330^2~73 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/?a=commitdiff_plain;h=e756bc5670d0f801ca43dc55b8eacde42a5b818b;p=linux-4.9.git kobject: fix kset sample error path Previously, example_init() leaked a kset if any of the object creations failed. This fixes the leak by calling kset_unregister() in the error path. Signed-off-by: Bjorn Helgaas Signed-off-by: Greg Kroah-Hartman --- diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index d0c687fd9802..5dce351f131f 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c @@ -262,6 +262,7 @@ baz_error: bar_error: destroy_foo_obj(foo_obj); foo_error: + kset_unregister(example_kset); return -EINVAL; }